package com.qf.dao;

import com.qf.pojo.SysUsers;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

/**
 * @author 千峰教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
public interface SysUsersMapper {

    @Select("select * from sys_users where username = #{username}")
    SysUsers findByUsername(String username);

    @Select("select r.name " +
            "from sys_user_role ur , sys_role r " +
            "where ur.r_id = r.id and ur.u_id = #{userId}")
    Set<String> findRolesByUserId(int id);

    @Select("select m.perms " +
            "from sys_user_role ur, sys_role_menu rm , sys_menu m " +
            "where ur.r_id = rm.r_id and rm.m_id = m.id and ur.u_id = #{userId}")
    Set<String> findPermsByUserId(int id);
}
